Process Trigger Example
Overview
Triggers are automatic actions that react to any change in data and run immediately after that, when a condition is met, to activate a process or execute an expression.
The following section illustrates an example regarding a trigger that launches a process.
Note
- Triggers will be executed over changes made through Bizagi's regular use (e.g., via expressions such as
setXpath
or through the Work Portal).- Triggers will NOT execute for changes made directly in the database.
- For virtualized entities, triggers will execute if changes are made through Bizagi's regular use. However, they will NOT execute if changes happen externally in the source table and Bizagi is updated via virtualization.
Example
Consider a scenario in a company where, after a successful purchase of a considerable amount, a poll is sent to the supplier to evaluate the relationship. To launch the poll, a trigger is set. For this example, the following data model has been defined:
When the purchase order is marked as Complete, a new Poll supplier case is started. To create the trigger:
- Go to the entity that is evaluated, in this case, the Purchase orders entity.
- Expand it, right-click the Triggers node, and select New trigger.
Configuring the Trigger
-
Set Display Name and Trigger Conditions
In the configuration window, set a display name and specify when the trigger will be launched.
For this case, the trigger is launched when an instance of Purchase orders is modified (marked as Complete). -
Define the Condition Rule
Select or create a condition rule to determine when the trigger is executed.
For this example, the trigger executes when:- The purchase value exceeds a predefined amount.
- The purchase is marked as successful.
As a best practice, the minimum purchase value is managed as a vocabulary definition.
-
Define the Action
Specify the process or expression to execute.
In this case, start a new poll as soon as the condition is met.- Select the Launch a new case for the following process option.
- Use the drop-down list to select the Poll process.
-
Save the Trigger
Once configured, click OK to save the trigger.
Viewing the Trigger
After creation, the trigger appears in the list when selecting the Triggers node:
Now, every time a new purchase exceeds the specified value, the trigger will start the Poll process.
Mapped Data
When the process starts, Bizagi injects the triggering record into the Process entity.
To allow this, the Process entity must have a foreign key referencing the entity that triggers the action.
In this example (refer to the data model above), the Supplier poll entity does NOT have a related entity to the Purchase orders entity (the one triggering the action). As a result, no data will be injected.